//-----------------------------------------------------------
//
//-----------------------------------------------------------
class RaijinWFire extends KatanaWFireB;
var() array<name> FireAnims;
var int swingCount;

simulated function bool AllowFire()
{
	if ( Level.NetMode == NM_DedicatedServer )
	{
		if(swingCount>30)
		{
			//Log("swingCount"@swingCount@"False");
			return false;
		}
		//Log("swingCount"@swingCount@"True");
		swingCount++;
		return true;
	}
	return true;
}


simulated function Timer()
{
	local Actor HitActor;
	local vector StartTrace, EndTrace, HitLocation, HitNormal;
	local rotator PointRot;
	local RaijinWProj p;

	if( !SRKFWeapon(Weapon).bNoHit )
	{
		StartTrace = Instigator.Location + Instigator.EyePosition();

		if( Instigator.Controller!=None && PlayerController(Instigator.Controller)==none && 
			Instigator.Controller.Enemy!=None )
		{
			PointRot = rotator(Instigator.Controller.Enemy.Location-StartTrace); // Give aimbot for bots.
		}
		else
		{
			PointRot = Instigator.GetViewRotation();
		}

		EndTrace = StartTrace + vector(PointRot)*weaponRange;
		HitActor = Instigator.Trace( HitLocation, HitNormal, EndTrace, StartTrace, true);

		if (HitActor!=None)
		{
			ImpactShakeView();

			if( HitActor.IsA('ExtendedZCollision') && HitActor.Base != none &&
				HitActor.Base.IsA('KFMonster') )
			{
				HitActor = HitActor.Base;
			}

			if( Level.NetMode==NM_Client )
			{
				Return;
			}

			if( (KFMonster(HitActor)!=none) )
			{
				p = Spawn(Class'PerksSimHostOrg.RaijinWProj', instigator,, HitLocation, PointRot);
				if(MeleeHitSounds.Length > 0)
				{
					Weapon.PlaySound(MeleeHitSounds[Rand(MeleeHitSounds.length)],SLOT_None,MeleeHitVolume,,,,false);
				}
			}
		}
	}
}

defaultproperties
{
}
